﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FJERP.BLL;
using FJERP.Model;

namespace FJERP
{
    public partial class Stock_Show : System.Web.UI.Page
    {
        StockBLL bll = new StockBLL();
        protected void StoLoad()
        {
            this.AspNetPager1.RecordCount = bll.Count();
            this.AspNetPager1.PageSize = 3;
            this.Repeater1.DataSource = bll.ShowStock(this.AspNetPager1.CurrentPageIndex,3);
            this.Repeater1.DataBind();
            Label1.Text = bll.Count().ToString();
        }
        protected void Page_Load(object sender, EventArgs e)
        {
            if(!IsPostBack)
            {
                StoLoad();
            }
        }

        protected void Repeater1_ItemCommand(object source, RepeaterCommandEventArgs e)
        {

        }

        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            StoLoad();
        }

        protected void Unnamed_ServerClick(object sender, EventArgs e)
        {
            int  count;
            
            this.Repeater1.DataSource = bll.Search(this.AspNetPager1.CurrentPageIndex, 3,this.WareHose_Name.Value,out count);
            this.Repeater1.DataBind();
            this.AspNetPager1.RecordCount = count;
            this.AspNetPager1.PageSize = 3;
        }
    }
}